//
//  UIView+Extension.swift
//  HSLMicroBlog
//
//  Created by mac on 15/12/8.
//  Copyright © 2015年 HSL. All rights reserved.
//

import UIKit

extension UIView {
    @IBInspectable var cornerRadius: CGFloat {
        get{
            return layer.cornerRadius
        }
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = layer.cornerRadius > 0
        }
    }
    
    @IBInspectable var borderWidth: CGFloat {
        get{
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
        }
    }
    
    @IBInspectable var borderColor: UIColor? {
        get{
            guard let color = layer.borderColor else {
                return nil
            }
            return UIColor(CGColor: color)
        }
        set{
            layer.borderColor = newValue?.CGColor
        }
    }
    
}
